<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>Hoodoo::Services::Interface::ToList</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../../css/github.css" type="text/css" media="screen" />
<script src="../../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>
    <div class="banner">
        <h1>
            <span class="type">Class</span>
            Hoodoo::Services::Interface::ToList
                <span class="parent">&lt;
                    Object
                </span>
        </h1>
        <ul class="files">
            <li><a href="../../../../files/lib/hoodoo/services/services/interface_rb.html">lib/hoodoo/services/services/interface.rb</a></li>
        </ul>
    </div>
    <div id="bodyContent">
        <div id="content">
    <div class="description">
      
<p>A class containing a series of accessors that describe allowed parameters
in a “list” call for a service implementation. The middleware uses this
validate incoming query strings for lists and reject requests that ask for
unsupported things. When instantiated the class sets itself up with
defaults that match those described by the your platform&#39;s API. When
passed to a <a
href="ToListDSL.html">Hoodoo::Services::Interface::ToListDSL</a> instance,
the DSL methods, if called, update the values stored herein.</p>

    </div>








    <!-- Method ref -->
    <div class="sectiontitle">Methods</div>
    <dl class="methods">
        <dt>D</dt>
        <dd>
          <ul>
              <li>
                <a href="#method-i-default_sort_direction">default_sort_direction</a>
              </li>
          </ul>
        </dd>
        <dt>N</dt>
        <dd>
          <ul>
              <li>
                <a href="#method-c-new">new</a>
              </li>
          </ul>
        </dd>
    </dl>








      <!-- Section attributes -->
      <div class="sectiontitle">Attributes</div>
      <table border='0' cellpadding='5'>
          <tr valign='top' id='attribute-i-default_sort_key'>
            <td class='attr-rw'>
              [RW]
            </td>
            <td class='attr-name'>default_sort_key</td>
            <td class='attr-desc'><p>Default sort key.</p></td>
          </tr>
          <tr valign='top' id='attribute-i-filter'>
            <td class='attr-rw'>
              [RW]
            </td>
            <td class='attr-name'>filter</td>
            <td class='attr-desc'><p>Array of supported filter keys as Strings; empty for none defined.</p></td>
          </tr>
          <tr valign='top' id='attribute-i-limit'>
            <td class='attr-rw'>
              [RW]
            </td>
            <td class='attr-name'>limit</td>
            <td class='attr-desc'><p>Limit value; an integer that limits page size in lists.</p></td>
          </tr>
          <tr valign='top' id='attribute-i-search'>
            <td class='attr-rw'>
              [RW]
            </td>
            <td class='attr-name'>search</td>
            <td class='attr-desc'><p>Array of supported search keys as Strings; empty for none defined.</p></td>
          </tr>
          <tr valign='top' id='attribute-i-sort'>
            <td class='attr-rw'>
              [RW]
            </td>
            <td class='attr-name'>sort</td>
            <td class='attr-desc'><p>Sort hash. Keys are supported sort fields, values are arrays of supported
sort directions. The first array entry is the default sort order for the
sort field.</p></td>
          </tr>
      </table>


    <!-- Methods -->
      <div class="sectiontitle">Class Public methods</div>
        <div class="method">
          <div class="title method-title" id="method-c-new">
              <b>new</b>()
            <a href="../../../../classes/Hoodoo/Services/Interface/ToList.html#method-c-new" name="method-c-new" class="permalink">Link</a>
          </div>

            <div class="description">
              <p>Create an instance with default settings.</p>
            </div>



            <div class="sourcecode">
              <p class="source-link">
                Source:
                <a href="javascript:toggleSource('method-c-new_source')" id="l_method-c-new_source">show</a>
              </p>
              <div id="method-c-new_source" class="dyn-source">
                <pre><span class="ruby-comment"># File lib/hoodoo/services/services/interface.rb, line 67</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">initialize</span>

  <span class="ruby-comment"># Remember, these are defaults for the &quot;to_list&quot; object of an</span>
  <span class="ruby-comment"># interface only. For interface-wide top level defaults, use the</span>
  <span class="ruby-comment"># embedded calls to the DSL in Interface::interface.</span>

  <span class="ruby-ivar">@limit</span>            = <span class="ruby-number">50</span>
  <span class="ruby-ivar">@sort</span>             = { <span class="ruby-string">&#39;created_at&#39;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">Set</span>.<span class="ruby-identifier">new</span>( [ <span class="ruby-string">&#39;desc&#39;</span>, <span class="ruby-string">&#39;asc&#39;</span> ] ) }
  <span class="ruby-ivar">@default_sort_key</span> = <span class="ruby-string">&#39;created_at&#39;</span>
  <span class="ruby-ivar">@search</span>           = []
  <span class="ruby-ivar">@filter</span>           = []
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
          </div>
      <div class="sectiontitle">Instance Public methods</div>
        <div class="method">
          <div class="title method-title" id="method-i-default_sort_direction">
              <b>default_sort_direction</b>()
            <a href="../../../../classes/Hoodoo/Services/Interface/ToList.html#method-i-default_sort_direction" name="method-i-default_sort_direction" class="permalink">Link</a>
          </div>

            <div class="description">
              <p>Default sort direction.</p>
            </div>



            <div class="sourcecode">
              <p class="source-link">
                Source:
                <a href="javascript:toggleSource('method-i-default_sort_direction_source')" id="l_method-i-default_sort_direction_source">show</a>
              </p>
              <div id="method-i-default_sort_direction_source" class="dyn-source">
                <pre><span class="ruby-comment"># File lib/hoodoo/services/services/interface.rb, line 53</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">default_sort_direction</span>
  <span class="ruby-ivar">@sort</span>[ <span class="ruby-identifier">default_sort_key</span>() ].<span class="ruby-identifier">first</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
          </div>
</div>

    </div>
  </body>
</html>
